import React, { useRef, useState } from 'react';
import BaseSlider from '../base-slider';

export default () => {
  const [isPass, setIsPass] = useState(false);
  const verify = useRef();
  const success = () => {
    setIsPass(true);
  };
  const reset = () => {
    console.log('$verify', verify);
    // $verify.reset();
    verify.current.reset();
    setIsPass(false);
  };
  return (
    <div className="box">
      <BaseSlider ref={verify} success={() => success()} />
      <p>验证状态：{isPass.toString()}</p>
      <button className="button" onClick={() => reset()}>
        重置状态
      </button>
    </div>
  );
};
